package org.bdware.doip.endpoint.doipClient;

import org.bdware.doip.core.doipMessage.DoipMessage;
import org.bdware.doip.core.exception.DoipConnectException;
import org.bdware.doip.core.model.digitalObject.DigitalObject;
import org.bdware.doip.core.model.metadata.SearchParameter;
import org.bdware.doip.core.model.operations.BasicOperations;
import org.bdware.doip.endpoint.doipServer.Op;

public interface DoipClient {

    @Op(op = BasicOperations.Hello)
    void hello(String id,DoipMessageCallback cb);

    @Op(op = BasicOperations.ListOps)
    void listOperations(String id,DoipMessageCallback cb);

    @Op(op = BasicOperations.Retrieve)
    void retrieve(String id, String element, boolean includeElementData, DoipMessageCallback cb);

    @Op(op = BasicOperations.Create)
    void create(String targetDoipService,DigitalObject digitalObject, DoipMessageCallback cb);

    @Op(op = BasicOperations.Update)
    void update(DigitalObject digitalObject, DoipMessageCallback cb);

    @Op(op = BasicOperations.Delete)
    void delete(String id, DoipMessageCallback cb);

    @Op(op = BasicOperations.Search)
    void search(String id, SearchParameter sp, DoipMessageCallback cb);

    void sendRawMessage(DoipMessage msg, DoipMessageCallback cb);

    void close();

    void connect(String url);

    void reconnect() throws DoipConnectException;

    String getRepoUrl();

    /*
        return the identifier of the repository/registry owner
        should be a id of DO user
     */
    String getRecipientID();

    void setRecipientID(String recipientID);

    boolean isConnected();

}
